from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-@rkkasrj^)-wj!x=14=xrd-i64&2r41w*^6&3tqk@u3h2u=f(m'
DEBUG = True
ALLOWED_HOSTS = ['*']  # '*'表示可以允许任何外网访问

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'app01.apps.App01Config',
    'rest_framework',
    'rest_framework_simplejwt',
]

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework_simplejwt.authentication.JWTAuthentication',
    ),
}

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'payment.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR / 'templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'payment.wsgi.application'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}

AUTH_PASSWORD_VALIDATORS = [
    {'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', },
    {'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', },
    {'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', },
    {'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', },
]

LANGUAGE_CODE = 'zh-hans'

TIME_ZONE = 'Asia/Shanghai'

USE_I18N = True

USE_TZ = True

STATIC_URL = 'static/'
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

# ########### 微信支付资料 #######################
WECHAT_APPID = 'wx1c4068177526fbae'  # '小程序AppID': 好家猫微商城
APP_SECRET = '0c6c78c640e097cf1279a7296e2aaa39'  # 小程序密钥: 好家猫微商城

WECHAT_MCHID = '1227281402'  # '商户号': 上海御猫王服饰有限公司
WECHAT_API3_KEY = '20040125ZYFZWD20040125zyfzwd3232'  # 'APIv3密钥'
WECHAT_API2_KEY = '20040125ZYFZWD20040125zyfzwd3232'  # 'APIv2密钥'
WECHAT_SERIAL_NO = '69ED4F1459EA39511A23094272D8C1DA8621F478'  # '证书序列号'
WECHAT_PRIVATE_KEY = open('cert_dir/apiclient_key.pem').read()   # 私钥
WECHAT_CERT = open('cert_dir/apiclient_cert.pem').read()         # 公钥
WECHAT_NOTIFY_URL = 'https://3037747c.r7.cpolar.top/'  # V2和V3版本回调通知地址+自己的函数去读取执行
CERT_DIR = 'cert_dir/'  # 证书存放目录
